<?php


namespace core\event;


class EventFactory {

    public static function build(array $input_json): ?Event {
        $SWITCH = [
            'message' => [
                'group' => EventGroupMessage::class,
                'private' => EventMessage::class,
            ],
        ];
        if (!isset($SWITCH[$input_json['post_type']][$input_json['message_type']])) {
            return null;
        }
        return new $SWITCH[$input_json['post_type']][$input_json['message_type']]($input_json);
    }

}
